#include "StdAfx.h"
#include "QNewTreeWidget.h"

#include "totalres.h"

QNewTreeWidget::QNewTreeWidget(QWidget *parent)
	:QTreeWidget(parent)
{

}

QNewTreeWidget::~QNewTreeWidget(void)
{
}

void QNewTreeWidget::keyPressEvent(QKeyEvent *event)
{
	if (!TotalRes::GetInstance().OnKeyPressEvent(event))
		QTreeWidget::keyPressEvent(event);
	else
		event->accept();

	return;
}

void QNewTreeWidget::setRowCount(int nRowCount)
{
	m_vecRowItem.resize(nRowCount);
}

int QNewTreeWidget::getRowCount(void)
{
	return m_vecRowItem.count();
}

void QNewTreeWidget::clear(void)
{
	QTreeWidget::clear();
	m_vecRowItem.clear();
}

bool QNewTreeWidget::setRowItem(int nRowIndex, QTreeWidgetItem* pRowItem)
{
	LOG_PROCESS_ERROR(nRowIndex >= 0 && nRowIndex < m_vecRowItem.count());

	m_vecRowItem[nRowIndex] = pRowItem;

	return true;
Exit0:
	return false;
}

QTreeWidgetItem* QNewTreeWidget::getRowItem(int nRowIndex)
{
	LOG_PROCESS_ERROR(nRowIndex >= 0 && nRowIndex < m_vecRowItem.count());

	return m_vecRowItem[nRowIndex];
Exit0:
	return NULL;
}
